﻿Imports System.Text
Namespace DataMaster
    Public Class clsMSTDISCOUNTRow
        Inherits ADODBU.RowClass
        Private mVar_DISACRCOD As System.Int32
        Private mVar_DISCACREXT As System.String
        Private mVar_DISCACRDESC As System.String
        Private mVar_DISCACRTYPE As System.Int32
        Private mVar_DISCACRGRP As System.Int32
        Private mVar_DISCACRMRG As System.Decimal
        Private mVar_DISCACRPERCEN As System.Decimal
        Private mVar_DISCACRAMOUNT As System.Decimal
        Private mVar_DISCACRDCRE As System.DateTime
        Private mVar_DISACRDMAJ As System.DateTime
        Private mVar_DISACRUTIL As System.String
        Private mVar_DISACRPROG As System.String
        Private mVar_DirtyDISACRCOD As Boolean = False
        Private mVar_DirtyDISCACREXT As Boolean = False
        Private mVar_DirtyDISCACRDESC As Boolean = False
        Private mVar_DirtyDISCACRTYPE As Boolean = False
        Private mVar_DirtyDISCACRGRP As Boolean = False
        Private mVar_DirtyDISCACRMRG As Boolean = False
        Private mVar_DirtyDISCACRPERCEN As Boolean = False
        Private mVar_DirtyDISCACRAMOUNT As Boolean = False
        Private mVar_DirtyDISCACRDCRE As Boolean = False
        Private mVar_DirtyDISACRDMAJ As Boolean = False
        Private mVar_DirtyDISACRUTIL As Boolean = False
        Private mVar_DirtyDISACRPROG As Boolean = False
        Private mIsOnInit As Boolean
        Public DataSource As ADODBU.Recordset
        Public RowOrigin As clsMSTDISCOUNTRow
        ''[------------------------------------------------------------------------]'
        Public Sub New()
            RowOrigin = New clsMSTDISCOUNTRow(True)
        End Sub
        ''[------------------------------------------------------------------------]'
        Friend Sub New(lCut As Boolean)
            '--- untuk memutus loop reference 
        End Sub
        ''[------------------------------------------------------------------------]'
        ''' <summary>
        ''' create new this class from inherited of this class or its self
        ''' </summary>
        ''' <param name="recdataRow"></param>
        ''' <remarks></remarks>
        Public Sub New(ByVal recdataRow As ADODBU.RowClass)
            RowOrigin = New clsMSTDISCOUNTRow(True)
            Me.JoinValue(recdataRow)
        End Sub
        ''[------------------------------------------------------------------------]'
        Public Sub New(recData As ADODBU.Recordset)
            RowOrigin = New clsMSTDISCOUNTRow(True)
            DataSource = recData
            Try
                InitVar(recData.GetCurrentDataRow)
            Catch
            End Try
        End Sub

        ''[------------------------------------------------------------------------]'
        Public Sub New(recdataRow As DataRow)
            RowOrigin = New clsMSTDISCOUNTRow(True)
            InitVar(recdataRow)
        End Sub

#Region "Initialize vars "
        ''[------------------------------------------------------------------------]'
        Private Sub InitVar(Fields As DataRow)
            Try
                mVar_DISACRCOD = Fields("DISACRCOD")
                RowOrigin.DISACRCOD = mVar_DISACRCOD
            Catch e As Exception
            End Try
            Try
                mVar_DISCACREXT = Fields("DISCACREXT")
                RowOrigin.DISCACREXT = mVar_DISCACREXT
            Catch e As Exception
            End Try
            Try
                mVar_DISCACRDESC = Fields("DISCACRDESC")
                RowOrigin.DISCACRDESC = mVar_DISCACRDESC
            Catch e As Exception
            End Try
            Try
                mVar_DISCACRTYPE = Fields("DISCACRTYPE")
                RowOrigin.DISCACRTYPE = mVar_DISCACRTYPE
            Catch e As Exception
            End Try
            Try
                mVar_DISCACRGRP = Fields("DISCACRGRP")
                RowOrigin.DISCACRGRP = mVar_DISCACRGRP
            Catch e As Exception
            End Try
            Try
                mVar_DISCACRMRG = Fields("DISCACRMRG")
                RowOrigin.DISCACRMRG = mVar_DISCACRMRG
            Catch e As Exception
            End Try
            Try
                mVar_DISCACRPERCEN = Fields("DISCACRPERCEN")
                RowOrigin.DISCACRPERCEN = mVar_DISCACRPERCEN
            Catch e As Exception
            End Try
            Try
                mVar_DISCACRAMOUNT = Fields("DISCACRAMOUNT")
                RowOrigin.DISCACRAMOUNT = mVar_DISCACRAMOUNT
            Catch e As Exception
            End Try
            Try
                mVar_DISCACRDCRE = Fields("DISCACRDCRE")
                RowOrigin.DISCACRDCRE = mVar_DISCACRDCRE
            Catch e As Exception
            End Try
            Try
                mVar_DISACRDMAJ = Fields("DISACRDMAJ")
                RowOrigin.DISACRDMAJ = mVar_DISACRDMAJ
            Catch e As Exception
            End Try
            Try
                mVar_DISACRUTIL = Fields("DISACRUTIL")
                RowOrigin.DISACRUTIL = mVar_DISACRUTIL
            Catch e As Exception
            End Try
            Try
                mVar_DISACRPROG = Fields("DISACRPROG")
                RowOrigin.DISACRPROG = mVar_DISACRPROG
            Catch e As Exception
            End Try
        End Sub


#End Region
        ''[------------------------------------------------------------------------]'
#Region "Properties"
        Public Property DISACRCOD As System.Int32
            Get
                Return mVar_DISACRCOD
            End Get
            Set(ByVal Value As System.Int32)
                mVar_DISACRCOD = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("DISACRCOD"))
                If Not mIsOnInit Then
                    mVar_DirtyDISACRCOD = True
                End If
            End Set
        End Property
        Public Property DISCACREXT As System.String
            Get
                Return mVar_DISCACREXT
            End Get
            Set(ByVal Value As System.String)
                mVar_DISCACREXT = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("DISCACREXT"))
                If Not mIsOnInit Then
                    mVar_DirtyDISCACREXT = True
                End If
            End Set
        End Property
        Public Property DISCACRDESC As System.String
            Get
                Return mVar_DISCACRDESC
            End Get
            Set(ByVal Value As System.String)
                mVar_DISCACRDESC = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("DISCACRDESC"))
                If Not mIsOnInit Then
                    mVar_DirtyDISCACRDESC = True
                End If
            End Set
        End Property
        Public Property DISCACRTYPE As System.Int32
            Get
                Return mVar_DISCACRTYPE
            End Get
            Set(ByVal Value As System.Int32)
                mVar_DISCACRTYPE = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("DISCACRTYPE"))
                If Not mIsOnInit Then
                    mVar_DirtyDISCACRTYPE = True
                End If
            End Set
        End Property
        Public Property DISCACRGRP As System.Int32
            Get
                Return mVar_DISCACRGRP
            End Get
            Set(ByVal Value As System.Int32)
                mVar_DISCACRGRP = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("DISCACRGRP"))
                If Not mIsOnInit Then
                    mVar_DirtyDISCACRGRP = True
                End If
            End Set
        End Property
        Public Property DISCACRMRG As System.Decimal
            Get
                Return mVar_DISCACRMRG
            End Get
            Set(ByVal Value As System.Decimal)
                mVar_DISCACRMRG = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("DISCACRMRG"))
                If Not mIsOnInit Then
                    mVar_DirtyDISCACRMRG = True
                End If
            End Set
        End Property
        Public Property DISCACRPERCEN As System.Decimal
            Get
                Return mVar_DISCACRPERCEN
            End Get
            Set(ByVal Value As System.Decimal)
                mVar_DISCACRPERCEN = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("DISCACRPERCEN"))
                If Not mIsOnInit Then
                    mVar_DirtyDISCACRPERCEN = True
                End If
            End Set
        End Property
        Public Property DISCACRAMOUNT As System.Decimal
            Get
                Return mVar_DISCACRAMOUNT
            End Get
            Set(ByVal Value As System.Decimal)
                mVar_DISCACRAMOUNT = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("DISCACRAMOUNT"))
                If Not mIsOnInit Then
                    mVar_DirtyDISCACRAMOUNT = True
                End If
            End Set
        End Property
        Public Property DISCACRDCRE As System.DateTime
            Get
                Return mVar_DISCACRDCRE
            End Get
            Set(ByVal Value As System.DateTime)
                mVar_DISCACRDCRE = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("DISCACRDCRE"))
                If Not mIsOnInit Then
                    mVar_DirtyDISCACRDCRE = True
                End If
            End Set
        End Property
        Public Property DISACRDMAJ As System.DateTime
            Get
                Return mVar_DISACRDMAJ
            End Get
            Set(ByVal Value As System.DateTime)
                mVar_DISACRDMAJ = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("DISACRDMAJ"))
                If Not mIsOnInit Then
                    mVar_DirtyDISACRDMAJ = True
                End If
            End Set
        End Property
        Public Property DISACRUTIL As System.String
            Get
                Return mVar_DISACRUTIL
            End Get
            Set(ByVal Value As System.String)
                mVar_DISACRUTIL = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("DISACRUTIL"))
                If Not mIsOnInit Then
                    mVar_DirtyDISACRUTIL = True
                End If
            End Set
        End Property
        Public Property DISACRPROG As System.String
            Get
                Return mVar_DISACRPROG
            End Get
            Set(ByVal Value As System.String)
                mVar_DISACRPROG = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("DISACRPROG"))
                If Not mIsOnInit Then
                    mVar_DirtyDISACRPROG = True
                End If
            End Set
        End Property
        Public ReadOnly Property DISACRCODIsDirty As Boolean
            Get
                Return mVar_DirtyDISACRCOD
            End Get
        End Property
        Public ReadOnly Property DISCACREXTIsDirty As Boolean
            Get
                Return mVar_DirtyDISCACREXT
            End Get
        End Property
        Public ReadOnly Property DISCACRDESCIsDirty As Boolean
            Get
                Return mVar_DirtyDISCACRDESC
            End Get
        End Property
        Public ReadOnly Property DISCACRTYPEIsDirty As Boolean
            Get
                Return mVar_DirtyDISCACRTYPE
            End Get
        End Property
        Public ReadOnly Property DISCACRGRPIsDirty As Boolean
            Get
                Return mVar_DirtyDISCACRGRP
            End Get
        End Property
        Public ReadOnly Property DISCACRMRGIsDirty As Boolean
            Get
                Return mVar_DirtyDISCACRMRG
            End Get
        End Property
        Public ReadOnly Property DISCACRPERCENIsDirty As Boolean
            Get
                Return mVar_DirtyDISCACRPERCEN
            End Get
        End Property
        Public ReadOnly Property DISCACRAMOUNTIsDirty As Boolean
            Get
                Return mVar_DirtyDISCACRAMOUNT
            End Get
        End Property
        Public ReadOnly Property DISCACRDCREIsDirty As Boolean
            Get
                Return mVar_DirtyDISCACRDCRE
            End Get
        End Property
        Public ReadOnly Property DISACRDMAJIsDirty As Boolean
            Get
                Return mVar_DirtyDISACRDMAJ
            End Get
        End Property
        Public ReadOnly Property DISACRUTILIsDirty As Boolean
            Get
                Return mVar_DirtyDISACRUTIL
            End Get
        End Property
        Public ReadOnly Property DISACRPROGIsDirty As Boolean
            Get
                Return mVar_DirtyDISACRPROG
            End Get
        End Property
#End Region
        ''[------------------------------------------------------------------------]'
        Public Function SaveToDataSource() As String
            Dim msgErr As String
            msgErr = ""
            If mVar_DirtyDISACRCOD Then
                Try
                    DataSource.Fields("DISACRCOD") = mVar_DISACRCOD
                Catch e As Exception
                    msgErr = msgErr & e.Message
                End Try
            End If

            If mVar_DirtyDISCACREXT Then
                Try
                    DataSource.Fields("DISCACREXT") = mVar_DISCACREXT
                Catch e As Exception
                    msgErr = msgErr & e.Message
                End Try
            End If

            If mVar_DirtyDISCACRDESC Then
                Try
                    DataSource.Fields("DISCACRDESC") = mVar_DISCACRDESC
                Catch e As Exception
                    msgErr = msgErr & e.Message
                End Try
            End If

            If mVar_DirtyDISCACRTYPE Then
                Try
                    DataSource.Fields("DISCACRTYPE") = mVar_DISCACRTYPE
                Catch e As Exception
                    msgErr = msgErr & e.Message
                End Try
            End If

            If mVar_DirtyDISCACRGRP Then
                Try
                    DataSource.Fields("DISCACRGRP") = mVar_DISCACRGRP
                Catch e As Exception
                    msgErr = msgErr & e.Message
                End Try
            End If

            If mVar_DirtyDISCACRMRG Then
                Try
                    DataSource.Fields("DISCACRMRG") = mVar_DISCACRMRG
                Catch e As Exception
                    msgErr = msgErr & e.Message
                End Try
            End If

            If mVar_DirtyDISCACRPERCEN Then
                Try
                    DataSource.Fields("DISCACRPERCEN") = mVar_DISCACRPERCEN
                Catch e As Exception
                    msgErr = msgErr & e.Message
                End Try
            End If

            If mVar_DirtyDISCACRAMOUNT Then
                Try
                    DataSource.Fields("DISCACRAMOUNT") = mVar_DISCACRAMOUNT
                Catch e As Exception
                    msgErr = msgErr & e.Message
                End Try
            End If

            If mVar_DirtyDISCACRDCRE Then
                Try
                    DataSource.Fields("DISCACRDCRE") = Format(mVar_DISCACRDCRE, DataSource.DbConn.DateFormat)
                Catch e As Exception
                    msgErr = msgErr & e.Message
                End Try
            End If

            If mVar_DirtyDISACRDMAJ Then
                Try
                    DataSource.Fields("DISACRDMAJ") = Format(mVar_DISACRDMAJ, DataSource.DbConn.DateFormat)
                Catch e As Exception
                    msgErr = msgErr & e.Message
                End Try
            End If

            If mVar_DirtyDISACRUTIL Then
                Try
                    DataSource.Fields("DISACRUTIL") = mVar_DISACRUTIL
                Catch e As Exception
                    msgErr = msgErr & e.Message
                End Try
            End If

            If mVar_DirtyDISACRPROG Then
                Try
                    DataSource.Fields("DISACRPROG") = mVar_DISACRPROG
                Catch e As Exception
                    msgErr = msgErr & e.Message
                End Try
            End If

            Return msgErr
        End Function

        ''[------------------------------------------------------------------------]'
        Public Sub ClearDirty()
            mVar_DirtyDISACRCOD = False
            mVar_DirtyDISCACREXT = False
            mVar_DirtyDISCACRDESC = False
            mVar_DirtyDISCACRTYPE = False
            mVar_DirtyDISCACRGRP = False
            mVar_DirtyDISCACRMRG = False
            mVar_DirtyDISCACRPERCEN = False
            mVar_DirtyDISCACRAMOUNT = False
            mVar_DirtyDISCACRDCRE = False
            mVar_DirtyDISACRDMAJ = False
            mVar_DirtyDISACRUTIL = False
            mVar_DirtyDISACRPROG = False
        End Sub
        ''[------------------------------------------------------------------------]'
        Public Sub SetDirty()
            mVar_DirtyDISACRCOD = True
            mVar_DirtyDISCACREXT = True
            mVar_DirtyDISCACRDESC = True
            mVar_DirtyDISCACRTYPE = True
            mVar_DirtyDISCACRGRP = True
            mVar_DirtyDISCACRMRG = True
            mVar_DirtyDISCACRPERCEN = True
            mVar_DirtyDISCACRAMOUNT = True
            mVar_DirtyDISCACRDCRE = True
            mVar_DirtyDISACRDMAJ = True
            mVar_DirtyDISACRUTIL = True
            mVar_DirtyDISACRPROG = True
        End Sub

    End Class
End Namespace